package com.zzy.controller;

import com.zzy.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zhangzhenyu
 * @Date: 2021/1/20
 */
@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;



    @RequestMapping("/create/{email}")
    public Boolean create(@PathVariable String email){
        return codeService.create(email);
    }

    @RequestMapping("/validate/{email}/{code}")
    public int validate(@PathVariable String email,@PathVariable String code){
        return codeService.validate(email,code);
    }

}
